/**
 * Meituan.com Inc.
 * Copyright (c) 2010-2018 All Rights Reserved.
 */
package com.tuyou.cloud.common.controller;

import com.tuyou.cloud.common.po.User;
import lombok.extern.java.Log;
import org.springframework.web.bind.annotation.*;

/**
 * <p></p>
 *
 * @author tuyou@meituan.com
 * @version v0.1 2018-11-25 10:21 PM tuyou Exp $$
 */
@Log
@RestController
public class RestServerController {

    @RequestMapping(value = "/get", method = RequestMethod.GET)
    public String get(String name, Integer age) {
        return "get=name:" + name + ",age:" + age;
    }

    @RequestMapping(value = "/put/{id}", method = RequestMethod.PUT)
    public String put(@PathVariable("id") String id, @RequestBody User user) {
        return "put=name:" + user.getName() + ",age:" + user.getAge();
    }

    @RequestMapping(value = "/post", method = RequestMethod.POST)
    public String post(String name, Integer age, @RequestBody User user) {
        return "post=name:" + name + ",age:" + age;
    }

    @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
    public String delete(String id) {
        return "delete=" + id;
    }
}